package com.weixing.mall.provider.service.impl;

import com.baomidou.mybatisplus.extension.service.impl.ServiceImpl;
import com.weixing.mall.provider.mapper.WebsiteInfoMapper;
import com.weixing.mall.provider.model.domain.WebsiteInfo;
import com.weixing.mall.provider.model.dto.cms.WebsiteInfoDto;
import com.weixing.mall.provider.model.vo.cms.WebsiteInfoVo;
import com.weixing.mall.provider.service.IWebsiteInfoService;
import org.springframework.beans.BeanUtils;
import org.springframework.stereotype.Service;

/**
 * @ClassName WebsiteInfoServiceImpl
 * @Description TODO <br/>
 * @Author gjq
 * @Modified By:
 * @Date 2019/9/20
 * @Version 1.0
 **/
/**
 * <p>
 * CMS模块-网站基础设置表 服务实现类
 * </p>
 *
 * @author Small
 * @since 2019-11-18
 */
@Service
public class WebsiteInfoServiceImpl extends ServiceImpl<WebsiteInfoMapper, WebsiteInfo> implements IWebsiteInfoService {


    @Override
    public WebsiteInfoVo selectWebsiteInfo() {
        return baseMapper.selectWebsiteInfo();
    }

    @Override
    public void save(WebsiteInfoDto websiteInfoDto) {

        WebsiteInfo websiteInfo = new WebsiteInfo();
        BeanUtils.copyProperties(websiteInfoDto,websiteInfo);
        if (null == websiteInfoDto.getId()){
            save(websiteInfo);
        }else{
            updateById(websiteInfo);
        }
    }
}
